package com.hl.web;

import com.hl.pojo.Charge;
import com.hl.pojo.Consultants;
import com.hl.service.ShouFeiService;
import com.hl.util.GeneralResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/ShouFei")
@CrossOrigin
public class ShouFeiController {
    @Autowired
    private ShouFeiService service;
    @RequestMapping("/getShouFeiMessage")
    public GeneralResult getShouFeiMessage() {
        List<Charge> list = service.getShouFeiMessage();
        System.out.println(list);
        return GeneralResult.success(list);
    }
    @RequestMapping("/getShouFeiMessageByName")
    public GeneralResult getShouFeiMessageByName(@RequestBody Map<String,String> map) {
        String consultantName = map.get("consultantName");
        System.out.println(consultantName);
        List<Charge> list = service.getShouFeiMessageByName(consultantName);
        System.out.println(list);
        return GeneralResult.success(list);
    }
    @RequestMapping("/deleteShouFei")
    public GeneralResult deleteShouFei(@RequestBody Map<String,Integer> map){
        Integer id = map.get("id");
        System.out.println(id);
        String s = service.deleteShouFei(id);
        return GeneralResult.success(s);
    }
}
